import 'package:flutter/material.dart';
import '../utils/ScreenAdapter.dart';

class BfButton extends StatefulWidget {
  Function _onTap;
  double _width;
  double _height;
  double _radiusSize;
  double _borderWidth;
  Widget _content;
  Color _borderColor;
  Color _backgroundColor = Color(0xfffea61c);

  BfButton({Key key, onTap, width, height, fontSize, radiusSize, borderWidth, borderColor, textColor, backgroundColor, content}) : super(key: key) {
    this._width = width ?? 240.0;
    this._height = height ?? 80;
    this._radiusSize = radiusSize;
    this._borderWidth = borderWidth ?? 0.0;
    this._borderColor = borderColor ?? Colors.transparent;
    this._backgroundColor = backgroundColor ?? Color(0xfffea61c);
    this._content = content ?? Text("确定");
    this._onTap = onTap ?? () {};
  }

  // BfButton({Key key})  : super(key: key);

  @override
  _BfButtonState createState() => _BfButtonState();
}

class _BfButtonState extends State<BfButton> {
  @override
  Widget build(BuildContext context) {
    return Container(
        child: InkWell(
      onTap: () {
        print(widget._width);
        widget._onTap();
      },
      child: Container(
          alignment: Alignment.center,
          width: ScreenAdapter.width(widget._width),
          height: ScreenAdapter.width(widget._height),
          decoration: BoxDecoration(
              color: widget._backgroundColor,
              border: Border.all(width: ScreenAdapter.width(widget._borderWidth), color: widget._borderColor),
              borderRadius: BorderRadius.all(Radius.circular(ScreenAdapter.width(widget._radiusSize ?? widget._height / 2)))),
          // child: Text("aaaa"),
          child: widget._content),
    ));
  }
}
